package com.kyrie.lib_sys.rocketMQ.Consumer;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import java.io.Serializable;

/**
 * 监听指定Topic和Consumer Group的消息测试
 *
 * @author heefM
 * @date 2025-
 */
@Component
@Slf4j
/**
 * 注意：consumerGroup需要全局唯一
 *
 * @author heefM
 * @date 2025-
 */
@RocketMQMessageListener(topic = "TestTopic", consumerGroup = "my-consumer-group")
public class TestMessageConsumer implements RocketMQListener<String> {

    @Override
    public void onMessage(String message) {
        // 这里处理收到的消息
        log.info(">>>>>>>>>> 收到消息: {}", message);
        // 进行你的业务逻辑处理...
    }
}
